#!/bin/bash
netmask=255.255.255.0
IP_PATH=/etc/sysconfig/network-scripts/ifcfg-eth0
GM_PATH=/etc/sysconfig/network
#删除或修改
rm -rf /etc/udev/rules.d/70-persistent-net.rules
#get infomation form input
# echo -e "Please input IP(FORMAT:192.168.46.88):\c"
# read ip

# echo -e "Please input GateWay(FORMAT:192.168.46.1):\c"
# read gateway
ip=192.168.1.1
#change ipaddress
echo "DEVICE=eth0">$IP_PATH
echo "BOOTPROTO=static">>$IP_PATH
echo "IPADDR=$ip">>$IP_PATH
echo "NETMASK=255.255.255.0">>$IP_PATH
echo "GATEWAY=$gateway">>$IP_PATH
echo "ONBOOT=yes">>$IP_PATH
#设置DNS服务
echo "DNS1=192.168.0.1">>$IP_PATH
#/etc/init.d/network restart
service network restart

#chmod a+x modify_network.sh



